package cn.jsonlu.dubbo.consumer;

import cn.jsonlu.dubbo.consumer.controller.BaseController;
import cn.jsonlu.dubbo.rpc.DemoService;
import cn.jsonlu.dubbo.rpc.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.annotation.Resource;
import java.util.HashMap;

/**
 * Author:JsonLu
 * DateTime:16/7/31 12:28
 * Email:jsonlu@qq.com
 * Desc:
 */
@Controller
public class IndexController extends BaseController{

    @Resource
    private DemoService demoService;
    @RequestMapping(value = {"/","index","index.html","index.htm"})
    @ResponseBody
    public Object index(){
        HashMap map = new HashMap();
        map.put("code",2001);
        map.put("desc","This data");
        map.put("time",System.currentTimeMillis());
        User user = new User();
        user.setAge(11);
        user.setName("Json");
        map.put("Now",user);
        user = demoService.grown(user);
        map.put("Grown",user);
        logger.info("dubbo");
        return map;
    }
}
